package service;

import bean.Knowledge;
import bean.User;
import dao.KnowledgeDao;
import dao.impl.KnowledgeDaoImpl;

/**
 * @ClassName KnowledgeService.class
 * @Description
 * @Author wq3stone
 * @Date 2022/12/22 19:42
 */
public class KnowledgeService {
    private KnowledgeDao knowledgeDao;
    private User user;

    public KnowledgeService() {
        knowledgeDao = new KnowledgeDaoImpl();
    }

    public int addKnowledge(Knowledge knowledge) {
        return knowledgeDao.insert(knowledge);
    }

    public int deleteKnowledge(int id) {
        return knowledgeDao.delete(id);
    }

    public int modifyKnowledge(Knowledge knowledge) {
        return knowledgeDao.modify(knowledge);
    }

    public Knowledge queryKnowledgeById(int id) {
        return knowledgeDao.queryKnowledgeById(id);
    }

    public Knowledge queryKnowledgeByTitle(String title) {
        return knowledgeDao.queryKnowledgeByTitle(title);
    }

    public Knowledge queryKnowledgeByCategory(String category) {
        return knowledgeDao.queryKnowledgeByCategory(category);
    }

    public Knowledge queryKnowledgeByKeyword(String keyword) {
        return knowledgeDao.queryKnowledgeByKeyword(keyword);
    }
}
